package com.magenta.maxoptra.gis;

/**
 * User: KuznetsovD
 * Date: 25.10.11
 * Time: 16:15
 */
public enum DecartaAttribute implements GISAccountProperty {
    UseProvider(GisParameter.use_map_provider, MapProviderType.decarta, GISFieldType.BOOLEAN, "false", true, 0L, true),
    DecartaMapKey(GisParameter.map_key, MapProviderType.decarta, GISFieldType.TEXT, "rs9s54", true, 1L, true),
    DecartaGeocodingKey(GisParameter.geocoding_key, MapProviderType.decarta, GISFieldType.TEXT, "magenta-kp|rs9s54", true, 2L, true),
    DecartaClientName(GisParameter.client_name, MapProviderType.decarta, GISFieldType.TEXT, "magenta-kp", true, 3l, true),
    DecartaMapId(GisParameter.map_id, MapProviderType.decarta, GISFieldType.TEXT, "us-carto", true, 4L, true),
    DecartaMapRegion(GisParameter.region, MapProviderType.decarta, GISFieldType.TEXT, "US", true, 5L, true),
    DecartaWSURl(GisParameter.base_url, MapProviderType.decarta, GISFieldType.TEXT, "http://wsdds2.dz.decarta.com/openls/openls",true, 6L, true),
    DecartaUseMapKey(GisParameter.use_map_key, MapProviderType.decarta, GISFieldType.BOOLEAN, "true", true, 7L, true),
    DecartaUseCustomGeoAddressForm(GisParameter.use_custom_geo_address_form, MapProviderType.decarta, GISFieldType.BOOLEAN, "false", true, 8L, true),
    DecartaUseShortestRoute(GisParameter.use_shortest_route, MapProviderType.decarta, GISFieldType.BOOLEAN, "true", false, 9L, true),
    DecartaEnableCache(GisParameter.enableCache, MapProviderType.decarta, GISFieldType.BOOLEAN, "true", true, 10L, true),
    DecartaCacheStorageTime(GisParameter.cacheStorageTime, MapProviderType.decarta, GISFieldType.INTEGER, "30", true, 11L, true),
    DecartaEnableLog(GisParameter.enableLogging, MapProviderType.decarta, GISFieldType.BOOLEAN, "false", false, 12L, true),
    DecartaUseMultiplePointsRouting(GisParameter.useMultiplePointsRouting, MapProviderType.decarta, GISFieldType.BOOLEAN, "false", false, 13L, true);

    private String name;
    private String label;
    private Long order;
    private GISFieldType type;
    private String defaultValue;
    private boolean required;

    private String groupName;

    private boolean important = true;

    private String tab = "GIS";

    public boolean isImportant() {
        return important;
    }

    public String getName() {
        return name;
    }

    public GISFieldType getType() {
        return type;
    }

    public String getDefaultValue() {
        return defaultValue;
    }

    public Boolean getMandatory() {
        return required;
    }

    public String getGroup() {
        return groupName;
    }

    public String getTab() {
        return tab;
    }

    public String getLabel() {
        return label;
    }

    public Long getOrder() {
        return order;
    }

    private DecartaAttribute(String name, String label, GISFieldType type, String defaultValue,
                             boolean required, String groupName, Long order, boolean important) {
        this.name = name;
        this.label = label;
        this.type = type;
        this.defaultValue = defaultValue;
        this.groupName = groupName;
        this.required = required;
        this.order = order;
        this.important = important;
    }

    private DecartaAttribute(GisParameter parameter, MapProviderType providerType, GISFieldType type,
                             String defaultValue, boolean required, Long order, boolean important) {
        this(parameter.withProvider(providerType.name()),
                parameter.getLabel(),
                type,
                defaultValue,
                required,
                providerType.getLabel(),
                order,
                important);
    }

    public boolean isReadOnly() {
        return false;
    }

}
